import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
// import './styles/element-variables.scss'
// element-variables.scss
import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import print from 'vue-print-nb'
import '@/icons' // icon
import '@/permission' // permission control
import components from './components'
Vue.use(components)
Vue.use(print)
import * as fiflter from '@/fiflter/index'
Object.keys(fiflter).forEach((item) => {
  Vue.filter(item, fiflter[item])
})
// import moment from 'moment'
// Vue.filter('timefilter', (val, str) => {
//   return moment(val).format(str)
// })
// import pagetools from '@/components/pagetools/pageTools.vue'
// Vue.component('pagetools', pagetools)
// 第一种按需导入全局注册
// import { imgerror, textcolor } from '@/directives'
// Vue.directive('imgerror', imgerror)
// Vue.directive('textcolor', textcolor)
//
// 第二种按需导入全局注册
// *代表所有模块，要做改名处理
// import * as directives from '@/directives'
// for (const key in directives) {
//   Vue.directive(key, directives[key])
// }

// 第三种按需导入全局注册
// 将对象遍历，生成数组，利用foreach遍历数组
import * as directives from '@/directives'
Object.keys(directives).forEach((item) => {
  Vue.directive(item, directives[item])
})
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)
// import i18n from '@/lang'
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  // i18n,
  render: (h) => h(App)
})
